using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class EditProfile : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (null != Membership.GetUser())
            {
                if (Roles.IsUserInRole(Membership.GetUser(true).UserName, "user"))
                {
                    ((TextBox)this.LoginViewUser.FindControl("changeBox")).Text = Membership.GetUser().Email;
                }
            }
        }
    }

    protected void changeEmailButton_Click(object sender, EventArgs e)
    {
        MembershipUser u = Membership.GetUser();
        
        u.Email = ((TextBox)this.LoginViewUser.FindControl("changeBox")).Text.Trim();
        Membership.UpdateUser(u);

        //Response.Write("Changed from " + Membership.GetUser().Email + " to " +
        //    ((TextBox)this.LoginViewUser.FindControl("changeBox")).Text);
    }
}
